package com.scs.application.core.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.scs.application.consts.GlobalConsts;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
 * @Description： 流程对象
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class FlowEntity extends DataEntity implements Serializable {

    @EntityFieldAnnotation(
            text = "流程状态。start：草稿，end：审核，其他根据流程配置自定义",
            length = "20",
            not_null = false,
            default_value = GlobalConsts.FLOW_START_VALUE,
            comment = ""
    )
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @Setter(AccessLevel.NONE)  //禁用SET，此属性慎重使用
    public String flowStatus ;

    @EntityFieldAnnotation(
            text = "流程修改时间",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public LocalDateTime flowModified;

    @EntityFieldAnnotation(
            text = "流程修改人",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    ) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public String flowModifier;

    @EntityFieldAnnotation(
            text = "流程修改人编码",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    ) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public String flowModifierCode;

    @EntityFieldAnnotation(
            text = "最近打印时间",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public Date printTime;

    @EntityFieldAnnotation(
            text = "是否打印",
            length = "",
            not_null = false,
            default_value = "0",
            comment = "是否打印"
    )
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public Boolean flagPrint;

    @EntityFieldAnnotation(
            text = "序列号",
            length = "10",
            not_null = false,
            default_value = "0",
            comment = "业务审核之后的序列号，打印对单使用"
    )
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public Integer snum;


    @EntityFieldAnnotation(
            text = "流程作废备注",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    public String flowCloseRemark;


    //流程状态需要与流程实例状态保持一致，此处先标记下，后期实现
    @Deprecated
    public FlowEntity setFlowStatus(String flowStatus) {
        this.flowStatus = flowStatus;
        return this;
    }

}
